package com.litbw.publicobservable;

/**
 * The SimpleMessage class is built to be used as an argument to the 
 * Observable method notifyObservers(Object). This version of Message simply
 * stores a desired recipient class. This desired recipient class can be
 * compared to Observer classes to ensure that ONLY the correct classes take
 * action. <BR><BR>
 * Subclasses of Message would be wise to extend SimpleMessage rather than
 * implement Message, in order to retain the desired recipient functionality.
 * @author Michael Morris
 *
 */
public class SimpleMessage implements Message {

	/** The Class which should take action on this message. */
	@SuppressWarnings("rawtypes")
	private Class recipient = java.lang.Object.class;
	
	/** {@inheritDoc} */
	@SuppressWarnings("rawtypes")
	@Override
	public Class getRecipientClass() {
		return recipient;
	}

	/** {@inheritDoc} */
	@SuppressWarnings("rawtypes")
	@Override
	public void setRecipientClass(Class c) {
		if (c == null)
			recipient = java.lang.Object.class;
		else
			recipient = c;
	}

}
